﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterAdmin.master" AutoEventWireup="true" CodeBehind="WithDrawEmployee.aspx.cs" Inherits="Project_Udrinkwater.PagesAdmin.WithDrawEmployee" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
     <script type="text/javascript">
    // <![CDATA[
         function ShowLoginWindow() {
             pcLogin.Show();
         }
    // ]]> 
    </script>
    <dx:ASPxRoundPanel ID="RPN_WithDraw" runat="server" Width="100%" 
         HeaderText="ข้อมูลการเบิกจ่ายล่วงหน้า">
        <HeaderStyle Font-Size="Medium" HorizontalAlign="Left" />
        <PanelCollection>
<dx:PanelContent runat="server" SupportsDisabledAttribute="True">
    <div>
        
        <table style="width: 100%">
            <tr>
                <td>
                    <dx:ASPxButton ID="ADD_WithDraw" runat="server" Text="เพิ่มรายการเบิกจ่าย" 
                        Theme="Youthful" Width="122px">
                        <ClientSideEvents Click="function(s, e) { ShowLoginWindow(); }" />
                    </dx:ASPxButton>
                </td>
                <td align="right">
                    <table align="right">
                        <tr>
                            <td>
                                <dx:ASPxButton ID="bt_ExportExcel" runat="server" 
                                    OnClick="bt_ExportExcel_Click" Text="พิมพ์รายงาน Excel">
                                </dx:ASPxButton>
                            </td>
                            <td>
                                <dx:ASPxButton ID="bt_ExportPDF" runat="server" Text="พิมพ์รายงาน PDF" 
                                    OnClick="bt_ExportPDF_Click">
                                </dx:ASPxButton>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
        
    </div>
    <dx:ASPxGridView ID="GV_ShowWithDraw" runat="server" AutoGenerateColumns="False" 
         DataSourceID="SqlDataSource_WithDraw" Font-Size="Small" KeyFieldName="ID" 
         Width="100%">
        <Columns>
            <dx:GridViewCommandColumn VisibleIndex="5" Width="150px">
                <DeleteButton Visible="True" Text="ลบข้อมูล">
                </DeleteButton>
                <EditButton Visible="True" Text="แก้ไขข้อมูล">
                </EditButton>
                <HeaderStyle HorizontalAlign="Center" />
                <CellStyle HorizontalAlign="Center">
                </CellStyle>
            </dx:GridViewCommandColumn>
            <dx:GridViewDataComboBoxColumn Caption="รหัสพนักงาน" FieldName="Employee_ID" 
                ShowInCustomizationForm="True" VisibleIndex="1">
              <PropertiesComboBox CallbackPageSize="30" DataSourceID="SqlDataSource1" 
                    EnableCallbackMode="True" IncrementalFilteringMode="StartsWith" 
                    TextFormatString="{0}" ValueField="Employee_ID" TextField="Employee_ID">
                  <Columns>
                      <dx:ListBoxColumn Caption="รหัสพนักงาน" FieldName="Employee_ID" Width="50px" />
                      <dx:ListBoxColumn Caption="ชื่อพนักงาน" FieldName="FirstName" Width="100px" />
                  </Columns>
                </PropertiesComboBox>
                <HeaderStyle HorizontalAlign="Center" />
                <CellStyle HorizontalAlign="Center">
                </CellStyle>
            </dx:GridViewDataComboBoxColumn>
            <dx:GridViewDataDateColumn FieldName="Date_withdraw" VisibleIndex="2" 
                Caption="วันที่เบิกจ่าย">
                <PropertiesDateEdit DisplayFormatString="dd MMMM yyyy">
                </PropertiesDateEdit>
                <HeaderStyle HorizontalAlign="Center" />
                <CellStyle HorizontalAlign="Center">
                </CellStyle>
            </dx:GridViewDataDateColumn>
            <dx:GridViewDataTextColumn FieldName="Num_withdraw" VisibleIndex="3" 
                Caption="จำนวนเงิน">
                <HeaderStyle HorizontalAlign="Center" />
                <CellStyle HorizontalAlign="Center">
                </CellStyle>
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="signature_Admin" VisibleIndex="4" 
                Caption="ผู้ทำรายการ" ReadOnly="True">
                <HeaderStyle HorizontalAlign="Center" />
                <CellStyle HorizontalAlign="Center">
                </CellStyle>
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="ID" ReadOnly="True" Visible="False" 
                VisibleIndex="0">
                <EditFormSettings Visible="False" />
                <HeaderStyle HorizontalAlign="Center" />
                <CellStyle HorizontalAlign="Center">
                </CellStyle>
            </dx:GridViewDataTextColumn>
        </Columns>
        <SettingsBehavior ConfirmDelete="True" />
        <SettingsText ConfirmDelete="ยืนยันการลบข้อมูล" />
    </dx:ASPxGridView>
       <asp:SqlDataSource ID="SqlDataSource_WithDraw" runat="server" 
         ConnectionString="<%$ ConnectionStrings:DB_Udrink %>" 
         DeleteCommand="DELETE FROM TB_withdraw WHERE ID=@ID" 
         
         SelectCommand="SELECT Employee_ID, Date_withdraw, Num_withdraw, signature_Admin, ID FROM TB_withdraw" 
         UpdateCommand="UPDATE TB_withdraw SET Employee_ID = @Employee_ID, Date_withdraw = @Date_withdraw, Num_withdraw = @Num_withdraw WHERE (ID = @ID)">
           <DeleteParameters>
               <asp:Parameter Name="ID" />
           </DeleteParameters>
           <UpdateParameters>
               <asp:Parameter Name="Employee_ID" />
               <asp:Parameter Name="Date_withdraw" />
               <asp:Parameter Name="Num_withdraw" />
               <asp:Parameter Name="ID" />
           </UpdateParameters>
     </asp:SqlDataSource>
       <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
         ConnectionString="<%$ ConnectionStrings:DB_Udrink %>" 
         
         SelectCommand="SELECT [Employee_ID], [FirstName] FROM [TB_Employee] WHERE Employee_ID &lt;&gt; 'INTERNET'">
     </asp:SqlDataSource>
       <dx:ASPxGridViewExporter ID="GV_ExportPay" runat="server" 
        GridViewID="GV_ShowWithDraw">
           <Styles>
               <Cell Font-Names="Angsana New">
               </Cell>
           </Styles>
           <PageHeader Center="รายงานการเบิกจ่ายล่วงหน้า">
               <Font Names="Angsana New" Size="18pt"></Font>
           </PageHeader>
    </dx:ASPxGridViewExporter>
       <dx:ASPxPopupControl ID="pcLogin" runat="server" 
    CloseAction="CloseButton" Modal="True"
        PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter" ClientInstanceName="pcLogin"
        HeaderText="ทำรายการเบิกจ่าย" AllowDragging="True" PopupAnimationType="None" 
         EnableViewState="False" Width="359px">
        <ClientSideEvents PopUp="function(s, e) { ASPxClientEdit.ClearGroup('entryGroup'); tbLogin.Focus(); }" />
        <ContentCollection>
            <dx:PopupControlContentControl ID="PopupControlContentControl1" runat="server">
                <dx:ASPxPanel ID="Panel1" runat="server" DefaultButton="btOK">
                    <PanelCollection>
                        <dx:PanelContent ID="PanelContent1" runat="server">
                            <table>
                                <tr>
                                    <td rowspan="7">
                                        <div class="pcmSideSpacer">
                                        </div>
                                    </td>
                                    <td class="pcmCellCaption" align="right" style="width: 109px">
                                        <dx:ASPxLabel ID="lblUsername1" runat="server" Text="รหัสพนักงาน:" 
                                            AssociatedControlID="tbLogin" Font-Size="Medium">
                                        </dx:ASPxLabel>
                                    </td>
                                    <td class="pcmCellText">
                                        <dx:ASPxComboBox ID="ASPxComboBox1" runat="server" 
                                            DataSourceID="SqlDataSource_SelectEmp" TextField="Employee_ID" 
                                            ValueField="Employee_ID" EnableCallbackMode="True" 
                                            EnableIncrementalFiltering="True" IncrementalFilteringMode="StartsWith" 
                                            TextFormatString="{0}">
                                            <Columns>
                                                <dx:ListBoxColumn Caption="รหัสพนักงาน" FieldName="Employee_ID" />
                                                <dx:ListBoxColumn Caption="ชื่อพนักงาน" FieldName="FirstName" />
                                            </Columns>
                                        </dx:ASPxComboBox>
                                        <asp:SqlDataSource ID="SqlDataSource_SelectEmp" runat="server" 
                                            ConnectionString="<%$ ConnectionStrings:DB_Udrink %>" 
                                            
                                            SelectCommand="SELECT Employee_ID,FirstName FROM [TB_Employee] WHERE Employee_ID &lt;&gt; 'INTERNET'">
                                        </asp:SqlDataSource>
                                    </td>
                                    <td rowspan="7">
                                        <div class="pcmSideSpacer">
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="pcmCellCaption" align="right" style="width: 109px; height: 23px" >
                                        <dx:ASPxLabel ID="lblPass1" runat="server" Text="วันที่เบิกจ่าย:" 
                                            AssociatedControlID="tbPassword" Font-Size="Medium">
                                        </dx:ASPxLabel>
                                    </td>
                                    <td class="pcmCellText" style="height: 23px">
                                        <dx:ASPxDateEdit ID="ASPxDateEdit1" runat="server" 
                                            DisplayFormatString="dd MMMM yyyy">
                                        </dx:ASPxDateEdit>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right" class="pcmCellCaption" style="width: 109px; height: 23px">
                                        &nbsp;</td>
                                    <td class="pcmCellText" style="height: 23px">
                                        <dx:ASPxCheckBoxList ID="chboxlist" runat="server" Font-Size="Small" 
                                            RepeatDirection="Horizontal" SelectedIndex="0">
                                            <Items>
                                                <dx:ListEditItem Selected="True" Text="เบิกล่วงหน้า" Value="0" />
                                                <dx:ListEditItem Text="อื่นๆ" Value="1" />
                                            </Items>
                                        </dx:ASPxCheckBoxList>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right" class="pcmCellCaption" style="width: 109px; height: 23px">
                                        <dx:ASPxLabel ID="lblPass3" runat="server" AssociatedControlID="tbPassword" 
                                            Font-Size="Medium" Text="ระบุรายละเอียด:">
                                        </dx:ASPxLabel>
                                    </td>
                                    <td class="pcmCellText" style="height: 23px">
                                        <dx:ASPxTextBox ID="tb_Detial" runat="server" Width="170px">
                                        </dx:ASPxTextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right" style="width: 109px">
                                        <dx:ASPxLabel ID="lblPass2" runat="server" AssociatedControlID="tbPassword" 
                                            Font-Size="Medium" Text="จำนวนเงิน:">
                                        </dx:ASPxLabel>
                                    </td>
                                    <td class="pcmCheckBox">
                                        <dx:ASPxTextBox ID="tb_Number" runat="server" Width="170px">
                                        </dx:ASPxTextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right" style="width: 109px">
                                        &nbsp;</td>
                                    <td class="pcmCheckBox">
                                        <table style="width: 100%">
                                            <tr>
                                                <td>
                                                    <dx:ASPxButton ID="btOK" runat="server" AutoPostBack="False" 
                                                        style="float: left; margin-right: 8px" Text="ตกลง" Width="80px" 
                                                        Font-Size="Small" OnClick="btOK_Click">
                                                        <ClientSideEvents Click="function(s, e) { if(ASPxClientEdit.ValidateGroup('entryGroup')) pcLogin.Hide(); }" />
                                                    </dx:ASPxButton>
                                                    <dx:ASPxButton ID="btCancel" runat="server" AutoPostBack="False" 
                                                        style="float: left; margin-right: 8px; margin-top: 0px;" Text="ยกเลิก" 
                                                        Width="80px" Font-Size="Small">
                                                        <ClientSideEvents Click="function(s, e) { pcLogin.Hide(); }" />
                                                    </dx:ASPxButton>
                                                </td>
                                                <td>
                                                    &nbsp;</td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <div class="pcmButton">
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </dx:PanelContent>
                    </PanelCollection>
                </dx:ASPxPanel>
                <div>
                    </div>
            </dx:PopupControlContentControl>
        </ContentCollection>
        <ContentStyle>
            <Paddings PaddingBottom="5px" />
        </ContentStyle>
    </dx:ASPxPopupControl>
</dx:PanelContent>
</PanelCollection>
    </dx:ASPxRoundPanel>
</asp:Content>
